package com.etlmaster.executor.utils;


import java.util.concurrent.Callable;

import com.etlmaster.executor.StepStack;

public class StackEntity  implements Callable<CallableResult> {
	public int FAILURE = 1;

	public static final String SUCCESS_MSG = "success";
	public static final int SUCCESS = 0;
	private StepStack stack;
	public StackEntity(StepStack stack){
		this.stack=stack;
	}

	private CallableResult threadResult;
	/*
	@Override
	public void run() {
		try{
			stack.startStack();
			setThreadResult(new CallableResult(SUCCESS, SUCCESS_MSG,null));
		}catch(Exception e){
			e.printStackTrace();
			setThreadResult(new CallableResult(FAILURE, "Stack failed!",null));

		}
	}*/

	public CallableResult getThreadResult() {
		return threadResult;
	}

	public void setThreadResult(CallableResult threadResult) {
		this.threadResult = threadResult;
	}

	@Override
	public CallableResult call() throws Exception {
		try{
			stack.startStack();
			setThreadResult(new CallableResult(SUCCESS, SUCCESS_MSG,null));
		}catch(Exception e){
			e.printStackTrace();
			setThreadResult(new CallableResult(FAILURE, "Stack failed!",null));

		}
		return threadResult;
	}

}
